package com.houzehui.demo.controller;



import com.bawei.common.upload.FileService;
import com.houzehui.demo.config.MsgResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author houzehui
 * @since 2022-04-08
 */
@RestController
@RequestMapping("/file")
public class FileController {

@Autowired
    FileService fileService;
    @PostMapping("upload")
    public String upload(@RequestBody MultipartFile file) throws IOException {
        String fileName = fileService.upload(file).getFileName();

        return "/"+fileName;

    }



}
